

#import "UITextField+LeftView.h"

@implementation UITextField (LeftView)

+ (UIView *)configLeftViewWithImage:(NSString *)image {
    UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 50, 45)];
    UIImageView *imgView = [UIImageView new];
    imgView.frame = CGRectMake(10, 10, 20, 20);
    imgView.image = [UIImage imageNamed:image];
    [view addSubview:imgView];
    return view;
}


+ (UIView *)configLeftViewWithLabel:(UILabel *)label {
    UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, label.width + 12, label.height)];
    label.origin = CGPointMake(12, 0);
    [view addSubview:label];
    return view;
}

+ (UIView *)configLeftViewWithLine {
    CGFloat height = 44;
    if (LLScreenWidth < 375) {
        height = 38;
    }
    UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 1, height)];
    CALayer *line = [CALayer layer];
    line.frame = CGRectMake(0, 0, 1, height);
    line.backgroundColor = LLColorRGB(230).CGColor;
    [view.layer addSublayer:line];
    return view;
}

@end
